package com.dlsy.ygj.dao.vindicateData.impl;

import java.util.List;

import net.taobaoge.common.framework.dao.impl.BaseDAOImpl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import com.dlsy.ygj.dao.vindicateData.IStoreroomInfoDAO;
import com.dlsy.ygj.entity.StoreroomInfo;

public class StoreroomInfoDAO extends BaseDAOImpl<StoreroomInfo> implements
		IStoreroomInfoDAO {
	private StoreroomInfo storeroomInfo;

	public StoreroomInfo getStoreroomInfo() {
		return storeroomInfo;
	}

	public void setStoreroomInfo(StoreroomInfo storeroomInfo) {
		this.storeroomInfo = storeroomInfo;
	}

	@SuppressWarnings("unchecked")
	public List<StoreroomInfo> findStoreroomByProperty(String name, int id) {
		return this
				.findByHql(
						"From StoreroomInfo S where S.storeroomName=? and S.strorefrontId=?",
						name, id);

	}

	@SuppressWarnings("unchecked")
	public List<StoreroomInfo> findStoreroomByID(int ID) {
		// TODO Auto-generated method stub
		Criteria criteria = getSession().createCriteria(StoreroomInfo.class);
		criteria.add((Restrictions.like("storeroomId", ID)));
		List<StoreroomInfo> Storeroomlist = criteria.list();
		if (Storeroomlist != null && Storeroomlist.size() > 0) {
			return Storeroomlist;
		}
		return null;
	}

}
